package org.yylnb.openplatform.gateway.api;

//  


import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.yylnb.openplatform.commons.utlis.CommonsResult;

import java.util.Map;

/**
 * @author RainLin
 * @date 2020/7/16 - 20:18
 */
@FeignClient("openapi-cache")
public interface CacheService {

    @PostMapping("/cache/set/{key}/{value}")
    CommonsResult set(@PathVariable String key, @PathVariable String value) ;

    @PostMapping("/cache/set/{key}/{value}/{time}")
    CommonsResult set(@PathVariable String key, @PathVariable String value, @PathVariable Long time) ;

    @PostMapping("/cache/setNx/{key}/{value}")
    CommonsResult setNx(@PathVariable String key, @PathVariable String value) ;


    @PostMapping("/cache/setNx/{key}/{value}/{time}")
    CommonsResult setNx(@PathVariable String key, @PathVariable String value, @PathVariable Long time) ;

    @GetMapping("/cache/get/{key}")
    CommonsResult get(@PathVariable String key) ;

    @PostMapping("/cache/del/{key}")
    CommonsResult del(@PathVariable String key) ;

    @PostMapping("/cache/expire/{key}/{time}")
    CommonsResult expire(@PathVariable String key, @PathVariable Long time) ;

    @GetMapping("/cache/getIncr/{key}")
    CommonsResult getIncr(@PathVariable String key) ;

    @GetMapping("/cache/getIncr/{key}/{delta}")
    CommonsResult getIncr(@PathVariable String key, @PathVariable Long delta) ;

    @GetMapping("/cache/sGet/{key}")
    CommonsResult sGet(@PathVariable String key) ;

    @PostMapping("/cache/sSet/{key}/{value}")
    CommonsResult sSet(@PathVariable String key, @PathVariable String value) ;

    @PostMapping("/cache/sSets/{key}")
    CommonsResult sSets(@PathVariable String key, String[] values) ;

    @PostMapping("/cache/sRemove/{key}/{member}")
    CommonsResult sRemove(@PathVariable String key, @PathVariable String value) ;

    @PostMapping("/cache/hSet/{key}/{field}/{value}")
    CommonsResult hSet(@PathVariable String key, @PathVariable String field, @PathVariable String value) ;

    @PostMapping("/cache/hSets/{key}")
    CommonsResult hSets(@PathVariable String key, @RequestBody Map<String, String> values) ;

    @GetMapping("/cache/hGet/{key}/{field}")
    CommonsResult<Map<String, String>> hGet(@PathVariable String key, @PathVariable String field) ;

    @PostMapping("/cache/hIncr/{key}/{field}/{delta}")
    CommonsResult hIncr( @PathVariable String key, @PathVariable String field, @PathVariable long delta);

    @GetMapping("/cache/hGetAll/{key}")
    CommonsResult hGetAll(@PathVariable String key) ;

    @GetMapping("/cache/getKeys/{parameter}")
    CommonsResult getKeys(@PathVariable String parameter);

    @GetMapping("/cache/zAdd/{key}/{value}/{score}")
    CommonsResult zAdd(@PathVariable String key, @PathVariable String value, @PathVariable double score);

    @GetMapping("/cache/zGetAll/{key}")
    CommonsResult zGetAll(@PathVariable String key);

    @GetMapping("/cache/zRangeByIndex/{key}/{start}/{stop}")
    CommonsResult zRangeByIndex(@PathVariable String key, @PathVariable int start, @PathVariable int stop);


    @GetMapping("/cache/zRangeByScore/{key}/{min}/{max}")
    CommonsResult zRangeByScore(@PathVariable String key, @PathVariable double min, @PathVariable double max);
}
